home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************************************
- *
- *
- * ObjectMacZapp -- a standard Mac OOP application template
- *
- *
- *
- * ZDefines.h -- some handy constants, etc
- *
- *
- *
- *
- *
- * © 1996, Graham Cox
- *
- *
- *
- *
- *************************************************************************************************/
-
- #pragma once
-
- #ifndef __ZDEFINES__
- #define __ZDEFINES__
-
- // standard basic resource IDs, etc.
-
- #define kSleepTime 10 // number of ticks to give up to background programs
- #define kUntitledWindowID 128 // resource ID of the main window template
- #define kAppleMenuID 128 // ID of the apple menu
-
- #define kShowAboutBox 1
- #define kAboutBoxID 128
-
- #define kStdMenubarID 128 // ID of the default MBAR resource for the main menu bar
- #define kMiscStrListID 128
- #define kExceptionAlertID 130
- #define kMemoryLowAlertID 132
-
- #define kShortageFundSize 65536 // leave 64K in reserve for emergencies.
-
- // save changes alert constants
-
- #define kConfirmSaveAlertID 129
-
- enum
- {
- kConfirmSave = 1,
- kCloseNoSave,
- kCloseCancel
- };
-
- // macros for extracting window/dialog objects from mac windows
-
- #define IS_ZWINDOW_KIND 772 // in the 'kind' field of the window record
-
- #define GetZWindow(w) ((((WindowPeek) w)->windowKind == IS_ZWINDOW_KIND) || \
- (((WindowPeek) w)->windowKind == dialogKind))? \
- (ZWindow*) GetWRefCon(w) : NULL
-
- #define kStdScrollbarWidth 15
-
-
- // handy object disposal macros
-
- #define ForgetObject(p) {delete (p); (p) = NULL;}
- #define ForgetThis() {delete this;}
-
- // common useful macros
-
- #define MIN(a,b) ((a) < (b))? (a) : (b)
- #define MAX(a,b) ((a) > (b))? (a) : (b)
- #define ABS(x) (((x) < 0)? (-1 * (x)) : (x))
- #define CMP(a,b) ((a) < (b))? -1 : ((a) > (b))? 1 : 0;
- #define SGN(a) (((a) < 0)? -1 : 1 )
-
- // common non-ascii keys
-
- #define TAB_KEY 0x09
- #define RETURN_KEY 0x0D
- #define ENTER_KEY 0x03
- #define ESCAPE_KEY 0x1B
- #define UP_ARROW_KEY 0x1E
- #define DOWN_ARROW_KEY 0x1F
- #define LEFT_ARROW_KEY 0x1C
- #define RIGHT_ARROW_KEY 0x1D
- #define BACKSPACE_KEY 0x08
-
- // undefined and quiet exceptions
-
- #define kUnknownExceptionErr -999
- #define kSilentErr -1
-
- // global structure provides some common gestalt results
-
- typedef struct
- {
- Boolean supportsColour;
- Boolean hasDragManager;
- Boolean hasFPU;
- Boolean hasAppleEvents;
- Boolean hasAppearanceMgr;
- Boolean hasQuickTime;
- Boolean hasImgCompressionMgr;
- short systemVersion;
- }
- tMacInfo;
-
- // handy basic pascal string utilities
-
- void CopyPString( ConstStr255Param srcString, Str255 destString );
- void ConcatPStrings( Str255 first, ConstStr255Param second );
-
- // if you wish to use the Appearance Manager-savvy parts of MacZoop when running under
- // System 7.7, #define the following. If undefined, will implement standard System 7 behaviour.
- // If you compile with this defined, things should still work on previous system versions.
- // Note that if you are building an appearance aware app with MacZoop, you need to link with
- // the AppearanceLib library as well as define this.
-
- //#define APPEARANCE_MGR_AWARE 1
-
- #endif